
<!DOCTYPE html>
<html lang="zh-CN" class="loading">
<head><meta name="generator" content="Hexo 3.9.0">
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <title>Archive: 2017/3</title>
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
    <meta name="google" content="notranslate">
    <meta name="keywords" content="TriDiamond Obsidian,"> 
    
    <meta name="author" content="三·钻 TriDiamond"> 
    <link rel="alternative" href="atom.xml" title="三·钻 TriDiamond" type="application/atom+xml"> 
    <link rel="icon" href="/img/favicon.png"> 
    <link href="https://fonts.loli.net/css?family=Roboto+Mono|Rubik&display=swap" rel="stylesheet">
    <link rel="stylesheet" href="//at.alicdn.com/t/font_1429596_nzgqgvnmkjb.css">
    <link rel="stylesheet" href="//cdn.bootcss.com/animate.css/3.7.2/animate.min.css">
    <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/social-share.js/1.0.16/css/share.min.css">
    <link rel="stylesheet" href="//cdn.bootcss.com/codemirror/5.48.4/codemirror.min.css">
    <link rel="stylesheet" href="//cdn.bootcss.com/codemirror/5.48.4/theme/dracula.css">
    <link rel="stylesheet" href="/css/obsidian.css">
    <link rel="stylesheet" href="/css/ball-atom.min.css">
</head>
</html>

<body class="loading">
    <div class="loader">
        <div class="la-ball-atom la-2x">
            <div></div>
            <div></div>
            <div></div>
            <div></div>
        </div>
    </div>
    <span id="config-title" style="display:none">三·钻 TriDiamond</span>
    <div id="loader"></div>
    <div id="single" class="page">
    <div id="top">
        <a class="iconfont icon-left image-icon" href="javascript:history.back()"></a>
    </div>
    <div class="dark-obsidian section">
        <div class="article animated fadeIn">
            <div class="main">
                <div class="content animated fadeIn">
                    <div class="set">
                        <h1 style="text-align: center">Archived</h1>
                        <p style="text-align: center">「 14 」</p>
                        <ul class="timeline timeline-centered">
                            
                            
                                
                                <li class="timeline-item period">
                                    <div class="timeline-info"></div>
                                    <div class="timeline-marker"></div>
                                    <div class="timeline-content">
                                        <h2 class="timeline-title">十一月 2019</h2>
                                    </div>
                                </li>
                                
                                <li class="timeline-item">
                                    <div class="timeline-info">
                                        <span class="gradient-text">十一月 02, 2019</span>
                                    </div>
                                    <div class="timeline-marker"></div>
                                    <div class="timeline-content">
                                        <a class="timeline-title" target="_self" href="/2019/11/02/frontend/simplify-your-javascript-with.html">JavaScript中更简便的数组处理函数.map()，.reduce()，.filter()</a>
                                        <p>
                                            如果你刚接触JavaScript可能你还没有听说过.map()，.reduce()，.filter()。或者听说过，看过别人用过但是自己在实际项目中没有用过。在国内很多开发项目都是需要考虑IE8的兼容，为了兼容很多JavaScript好用的方法和技巧都被埋没了。但是我发现近几年开始，很多开发项目已经完全抛弃了IE这个魔鬼了。如果你不需要兼容古老的IE浏览器了，那就要开始熟悉一下这几个方法来处...
                                        </p>
                                    </div>
                                </li>
                            
                                
                                <li class="timeline-item">
                                    <div class="timeline-info">
                                        <span class="gradient-text">十一月 01, 2019</span>
                                    </div>
                                    <div class="timeline-marker"></div>
                                    <div class="timeline-content">
                                        <a class="timeline-title" target="_self" href="/2019/11/01/notes/learn-programming-more-effectively.html">如何高效学习编程</a>
                                        <p>
                                            编程确实不是一件容易的事情，除了要有较强的逻辑思维，还需要花大量的时间和集中力来提升和维持一定的高度。
与其他的领域不一样的是，技术每日都在变，所以对于编程初学者是很难一直与时并进的。就算是技术大神和老司机们也是追赶的比较吃力的。在技术领域打滚的这些年里，通过经历和经验总结出一些高效的学习方式和方法，在这篇文章里与大家分享。让我们现在就在技术领域的学习之路上奔跑吧！
锁定目标，风雨兼程在刚刚...
                                        </p>
                                    </div>
                                </li>
                            
                                
                                <li class="timeline-item period">
                                    <div class="timeline-info"></div>
                                    <div class="timeline-marker"></div>
                                    <div class="timeline-content">
                                        <h2 class="timeline-title">十月 2019</h2>
                                    </div>
                                </li>
                                
                                <li class="timeline-item">
                                    <div class="timeline-info">
                                        <span class="gradient-text">十月 19, 2019</span>
                                    </div>
                                    <div class="timeline-marker"></div>
                                    <div class="timeline-content">
                                        <a class="timeline-title" target="_self" href="/2019/10/19/backend/how-to-write-a-service.html">真正的`服务层`是怎么写的?</a>
                                        <p>
                                            其实很多系统架构里面都有服务层，但是服务对很多开发人员来说都有很多不同的定义和写法。甚至在我待过的公司里都有不同的写法和编写模式。每个人每个团队每个项目都有对服务不同的理解。那到底什么是服务，怎么理解才是对的呢？
你们有没有过无数个夜晚里严重怀疑人生，琢磨着到底哪一种服务才是对的？哪一种才是最好的写法，哪一种才能达到服务的真正意义？因为这种执着，我开始在国外的各种网站，大神们写过的开源大项目...
                                        </p>
                                    </div>
                                </li>
                            
                                
                                <li class="timeline-item">
                                    <div class="timeline-info">
                                        <span class="gradient-text">十月 11, 2019</span>
                                    </div>
                                    <div class="timeline-marker"></div>
                                    <div class="timeline-content">
                                        <a class="timeline-title" target="_self" href="/2019/10/11/frontend/debugging-skills-console.html">使用Console技巧提高JS调试技能</a>
                                        <p>
                                            其实 JavaScript 给到我们很多调试工具来调试代码，那问问你自己，你又知道多少呢？用到多少呢？
大部分前端开发在 JavaScript 调试代码的常规用法都是直接console.log，直接输出某一个变量或者返回数据里面的对象数据。当然毋庸置疑这样输出来调试是没有问题的。但是不是最优雅的方式来调试代码，其实还有更好的办法。作为一个有追求的技术人才，有更好的调试方式为什么不去使用呢？
...
                                        </p>
                                    </div>
                                </li>
                            
                                
                                <li class="timeline-item period">
                                    <div class="timeline-info"></div>
                                    <div class="timeline-marker"></div>
                                    <div class="timeline-content">
                                        <h2 class="timeline-title">九月 2019</h2>
                                    </div>
                                </li>
                                
                                <li class="timeline-item">
                                    <div class="timeline-info">
                                        <span class="gradient-text">九月 10, 2019</span>
                                    </div>
                                    <div class="timeline-marker"></div>
                                    <div class="timeline-content">
                                        <a class="timeline-title" target="_self" href="/2019/09/10/server/aliyun-webhook-setup.html">GitLab Webhook 自动部署</a>
                                        <p>
                                            创建与填写部署公钥创建部署公钥sudo -Hu www ssh-keygen -t rsa

如果创建失败首先需要创建/home/www/.ssh这个文件夹

查看公钥cat /home/www/.ssh/id_rsa.pub
添加Hook在阿里云code.aliyun.com上的profile&gt;ssh_key里面添加公钥
初始化git项目文件夹sudo -Hu www git clo...
                                        </p>
                                    </div>
                                </li>
                            
                                
                                <li class="timeline-item period">
                                    <div class="timeline-info"></div>
                                    <div class="timeline-marker"></div>
                                    <div class="timeline-content">
                                        <h2 class="timeline-title">一月 2019</h2>
                                    </div>
                                </li>
                                
                                <li class="timeline-item">
                                    <div class="timeline-info">
                                        <span class="gradient-text">一月 10, 2019</span>
                                    </div>
                                    <div class="timeline-marker"></div>
                                    <div class="timeline-content">
                                        <a class="timeline-title" target="_self" href="/2019/01/10/laravel/lumen-passport-usage.html">Lumen 使用 laravel passport</a>
                                        <p>
                                            Lumen是laravel的简洁版, 把laravel里面深重的依赖都去掉了, 所以直接安装laravel的passport是无法正常使用的.所以如果要在lumen上使用laravel的passport就需要安装另外一个插件.
安装要求
PHP &gt;= 5.6.3
Lumen &gt;= 5.3

Composer安装lumen-passport插件首先安装 Lumen Passport...
                                        </p>
                                    </div>
                                </li>
                            
                                
                                <li class="timeline-item">
                                    <div class="timeline-info">
                                        <span class="gradient-text">一月 10, 2019</span>
                                    </div>
                                    <div class="timeline-marker"></div>
                                    <div class="timeline-content">
                                        <a class="timeline-title" target="_self" href="/2019/01/10/laravel/lumen-multi-oauth.html">Lumen passport实现多个用户体系下的oauth验证</a>
                                        <p>
                                            这个教程是基于, lumen里面已经安装好了lumen-passport的插件, 如果还没有的话可以先到lumen使用laravel passport教程先安装.
改写Laravel Passport里面的UserRepository
文件路径 vendor\laravel\passport\src\Bridge\UserRepository.php


首先需要改写userRepositr...
                                        </p>
                                    </div>
                                </li>
                            
                                
                                <li class="timeline-item period">
                                    <div class="timeline-info"></div>
                                    <div class="timeline-marker"></div>
                                    <div class="timeline-content">
                                        <h2 class="timeline-title">四月 2017</h2>
                                    </div>
                                </li>
                                
                                <li class="timeline-item">
                                    <div class="timeline-info">
                                        <span class="gradient-text">四月 24, 2017</span>
                                    </div>
                                    <div class="timeline-marker"></div>
                                    <div class="timeline-content">
                                        <a class="timeline-title" target="_self" href="/2017/04/24/ionic/listen-to-back-button.html">IONIC 2 实现首页双击退出APP</a>
                                        <p>
                                            添加绑定值
首先在app/app.html下加入#myNav, 这个是用于绑定当前页面的导航标签

 &lt;ion-nav #myNav [root]=&quot;rootPage&quot;&gt;&lt;/ion-nav&gt;
代码实现
然后在app.component.ts做相对的改动

import { Component, ViewChild } from &#39;@angu...
                                        </p>
                                    </div>
                                </li>
                            
                                
                                <li class="timeline-item">
                                    <div class="timeline-info">
                                        <span class="gradient-text">四月 20, 2017</span>
                                    </div>
                                    <div class="timeline-marker"></div>
                                    <div class="timeline-content">
                                        <a class="timeline-title" target="_self" href="/2017/04/20/ionic/sliders-autoplay.html">IONIC 3 使用sliders轮播时拖动后autoplay失效解决方法</a>
                                        <p>
                                            我们先了解一下Ionic的Sliders
首先Ionic里面的sliders是用Swiper.js的第三方插件实现的, Ionic官方Sliders的文档里面只描述了可以直接写入html标签内的属性, 有很多高级属性是没有写在文档里面的. 

要怎么改变sliders的其他属性呢?
那如果我们要用到Swiper的其他属性怎么办呢? Ionic 2.x 的时候我们是可以在options里面传入...
                                        </p>
                                    </div>
                                </li>
                            
                                
                                <li class="timeline-item">
                                    <div class="timeline-info">
                                        <span class="gradient-text">四月 11, 2017</span>
                                    </div>
                                    <div class="timeline-marker"></div>
                                    <div class="timeline-content">
                                        <a class="timeline-title" target="_self" href="/2017/04/11/ionic/ios-blackscreen-fix.html">修复 Ionic 3.0.1 在IOS点击Tabs多次出现黑屏问题方法</a>
                                        <p>
                                            
Ionic 3.0.1 在IOS存在的一个严重的BUG，在IOS下多次重复点击TAB的时候页面会出现黑屏问题。


好消息是目前有一个暂时的修复方法。但是这个方法涉及修改Ionic核心代码，所以如果你们正在使用Ionic3发布APP，可以暂时使用以下办法修复问题。


在node_modules/ionic-angular/components/tabs/tabs.js找到一下代码 (46...
                                        </p>
                                    </div>
                                </li>
                            
                                
                                <li class="timeline-item">
                                    <div class="timeline-info">
                                        <span class="gradient-text">四月 10, 2017</span>
                                    </div>
                                    <div class="timeline-marker"></div>
                                    <div class="timeline-content">
                                        <a class="timeline-title" target="_self" href="/2017/04/10/ionic/upgrade-guide.html">IONIC 2 升级 3 教程</a>
                                        <p>
                                            升级步骤
这一次的升级Ionic 3 换成了使用最新的Angular 4.0, 最新的TypeScript, 添加了懒加载和修复了一些组件的bug.


首先更新package.json, 按照以下的代码相应替换你package.json里面的代码, 并且把你项目根目录下的node_modules文件夹删除掉, 然后运行npm install (如果你是用淘宝镜像可以运行 cnpm inst...
                                        </p>
                                    </div>
                                </li>
                            
                                
                                <li class="timeline-item period">
                                    <div class="timeline-info"></div>
                                    <div class="timeline-marker"></div>
                                    <div class="timeline-content">
                                        <h2 class="timeline-title">三月 2017</h2>
                                    </div>
                                </li>
                                
                                <li class="timeline-item">
                                    <div class="timeline-info">
                                        <span class="gradient-text">三月 19, 2017</span>
                                    </div>
                                    <div class="timeline-marker"></div>
                                    <div class="timeline-content">
                                        <a class="timeline-title" target="_self" href="/2017/03/19/ionic/comfirm-password-validators.html">IONIC 2 - 确认密码</a>
                                        <p>
                                            开发过程中一般在注册或者修改密码都要写一个密码确认的表格, 这篇文章就是记录怎么在Ionic2里面使用FormBuilder和Validators判断密码是否一致.
首先这篇文章是默认您已经了解怎么使用Angualr2的FormBuilder和Validator, 如果你还没了解这两个类的用法可以前去看Ionic2的文档
实例一个FormGroup
第一步首先我们需要实例了FormBuild...
                                        </p>
                                    </div>
                                </li>
                            
                                
                                <li class="timeline-item period">
                                    <div class="timeline-info"></div>
                                    <div class="timeline-marker"></div>
                                    <div class="timeline-content">
                                        <h2 class="timeline-title">二月 2017</h2>
                                    </div>
                                </li>
                                
                                <li class="timeline-item">
                                    <div class="timeline-info">
                                        <span class="gradient-text">二月 26, 2017</span>
                                    </div>
                                    <div class="timeline-marker"></div>
                                    <div class="timeline-content">
                                        <a class="timeline-title" target="_self" href="/2017/02/26/laravel/laravel5.4-passport-and-authen.html">Laravel 5.4 开发笔记</a>
                                        <p>
                                            Laravel最近出的Laravel5.4新加了挺多功能的, 比起我用了1年的5.1完善多了. 比较吸引我使用最新的5.4的有几点:

5.4 添加了谷歌内核的浏览器模拟操作
自带API认证类”PASSPORT”
路由自动分类, 现有有了Route自己的文件夹然后里面分类好了WEB和API的路由这一篇记录会分享一些我在尝试Laravel 5.4的过程中遇到的问题和经验

开发记录移植(Mig...
                                        </p>
                                    </div>
                                </li>
                            
                                
                                <li class="timeline-item">
                                    <div class="timeline-info">
                                        <span class="gradient-text">二月 25, 2017</span>
                                    </div>
                                    <div class="timeline-marker"></div>
                                    <div class="timeline-content">
                                        <a class="timeline-title" target="_self" href="/2017/02/25/ionic/dev-note.html">IONIC 2 开发笔记</a>
                                        <p>
                                            因为IONIC2才刚刚开始进入正式版, 中文文档基本都是不全的, 我现在开发都是在看英文文档在开发的过程中遇到了很多文档没有描述的问题, 而且开发的过程中遇到一些框架本身没有完善的功能和存在的BUG
我会在这个日记里面记录一些文档没有写的, 和我开发过程中遇到的一些坑和经验, 希望可以帮助那些刚刚接触IONIC2的程序猿们!
APP配置域名配置因为跨域问题，在开发时如果要用到本地环境进行开发...
                                        </p>
                                    </div>
                                </li>
                            
                        </ul>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

    <div id="back-to-top" class="animated fadeIn faster">
        <div class="flow"></div>
        <span class="percentage animated fadeIn faster">0%</span>
        <span class="iconfont icon-top02 animated fadeIn faster"></span>
    </div>
</body>
<footer>
    <p class="copyright" id="copyright">
        &copy; 2019
        <span class="gradient-text">
            三·钻 TriDiamond
        </span>.
        Powered by <a href="http://hexo.io/" title="Hexo" target="_blank" rel="noopener">Hexo</a>
        Theme
        <span class="gradient-text">
            <a href="https://github.com/TriDiamond/hexo-theme-obsidian" title="Obsidian" target="_blank" rel="noopener">Obsidian</a>
        </span>
        <small><a href="https://github.com/TriDiamond/hexo-theme-obsidian/blob/master/CHANGELOG.md" title="v1.4.3" target="_blank" rel="noopener">v1.4.3</a></small>
    </p>
</footer>

<script type="text/javascript" src="https://cdn.bootcss.com/mathjax/2.7.6/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>
<script>
  MathJax.Hub.Config({
    "HTML-CSS": {
      preferredFont: "TeX",
      availableFonts: ["STIX", "TeX"],
      linebreaks: {
        automatic: true
      },
      EqnChunk: (MathJax.Hub.Browser.isMobile ? 10 : 50)
    },
    tex2jax: {
      inlineMath: [
        ["$", "$"],
        ["\\(", "\\)"]
      ],
      processEscapes: true,
      ignoreClass: "tex2jax_ignore|dno",
      skipTags: ['script', 'noscript', 'style', 'textarea', 'pre', 'code']
    },
    TeX: {
      noUndefined: {
        attributes: {
          mathcolor: "red",
          mathbackground: "#FFEEEE",
          mathsize: "90%"
        }
      },
      Macros: {
        href: "{}"
      }
    },
    messageStyle: "none"
  });
</script>
<script>
  function initialMathJax() {
    MathJax.Hub.Queue(function () {
      var all = MathJax.Hub.getAllJax(),
        i;
      // console.log(all);
      for (i = 0; i < all.length; i += 1) {
        console.log(all[i].SourceElement().parentNode)
        all[i].SourceElement().parentNode.className += ' has-jax';
      }
    });
  }

  function reprocessMathJax() {
    if (typeof MathJax !== 'undefined') {
      MathJax.Hub.Queue(["Typeset", MathJax.Hub]);
    }
  }
</script>



    <link rel="stylesheet" href="//cdn.bootcss.com/gitalk/1.5.0/gitalk.min.css">
    <script src="//cdn.bootcss.com/gitalk/1.5.0/gitalk.min.js"></script>

<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script src="/js/plugin.js"></script>
<script src="/js/obsidian.js"></script>
<script src="/js/jquery.truncate.js"></script>
<script src="/js/search.js"></script>
<script src="//cdn.bootcss.com/typed.js/2.0.10/typed.min.js"></script>
<script src="//cdn.bootcss.com/blueimp-md5/2.12.0/js/md5.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/social-share.js/1.0.16/js/social-share.min.js"></script>

<script src="https://cdn.bootcss.com/codemirror/5.48.4/codemirror.min.js"></script>

    <script src="//cdn.bootcss.com/codemirror/5.48.4/mode/javascript/javascript.min.js"></script>

    <script src="//cdn.bootcss.com/codemirror/5.48.4/mode/css/css.min.js"></script>

    <script src="//cdn.bootcss.com/codemirror/5.48.4/mode/xml/xml.min.js"></script>

    <script src="//cdn.bootcss.com/codemirror/5.48.4/mode/htmlmixed/htmlmixed.min.js"></script>

    <script src="//cdn.bootcss.com/codemirror/5.48.4/mode/clike/clike.min.js"></script>

    <script src="//cdn.bootcss.com/codemirror/5.48.4/mode/php/php.min.js"></script>

    <script src="//cdn.bootcss.com/codemirror/5.48.4/mode/shell/shell.min.js"></script>

    <script src="//cdn.bootcss.com/codemirror/5.48.4/mode/python/python.min.js"></script>



    <script src="/js/busuanzi.min.js"></script>
    <script>
        $(document).ready(function () {
            if ($('span[id^="busuanzi_"]').length) {
                initialBusuanzi();
            }
        });
    </script>


<link rel="stylesheet" href="//cdn.bootcss.com/photoswipe/4.1.3/photoswipe.min.css">
<link rel="stylesheet" href="//cdn.bootcss.com/photoswipe/4.1.3/default-skin/default-skin.min.css">
<script src="//cdn.bootcss.com/photoswipe/4.1.3/photoswipe.min.js"></script>
<script src="//cdn.bootcss.com/photoswipe/4.1.3/photoswipe-ui-default.min.js"></script>

<!-- Root element of PhotoSwipe. Must have class pswp. -->
<div class="pswp" tabindex="-1" role="dialog" aria-hidden="true">
    <!-- Background of PhotoSwipe. 
         It's a separate element as animating opacity is faster than rgba(). -->
    <div class="pswp__bg"></div>
    <!-- Slides wrapper with overflow:hidden. -->
    <div class="pswp__scroll-wrap">
        <!-- Container that holds slides. 
            PhotoSwipe keeps only 3 of them in the DOM to save memory.
            Don't modify these 3 pswp__item elements, data is added later on. -->
        <div class="pswp__container">
            <div class="pswp__item"></div>
            <div class="pswp__item"></div>
            <div class="pswp__item"></div>
        </div>
        <!-- Default (PhotoSwipeUI_Default) interface on top of sliding area. Can be changed. -->
        <div class="pswp__ui pswp__ui--hidden">
            <div class="pswp__top-bar">
                <!--  Controls are self-explanatory. Order can be changed. -->
                <div class="pswp__counter"></div>
                <button class="pswp__button pswp__button--close" title="Close (Esc)"></button>
                <button class="pswp__button pswp__button--share" title="Share"></button>
                <button class="pswp__button pswp__button--fs" title="Toggle fullscreen"></button>
                <button class="pswp__button pswp__button--zoom" title="Zoom in/out"></button>
                <!-- Preloader demo http://codepen.io/dimsemenov/pen/yyBWoR -->
                <!-- element will get class pswp__preloader--active when preloader is running -->
                <div class="pswp__preloader">
                    <div class="pswp__preloader__icn">
                      <div class="pswp__preloader__cut">
                        <div class="pswp__preloader__donut"></div>
                      </div>
                    </div>
                </div>
            </div>
            <div class="pswp__share-modal pswp__share-modal--hidden pswp__single-tap">
                <div class="pswp__share-tooltip"></div> 
            </div>
            <button class="pswp__button pswp__button--arrow--left" title="Previous (arrow left)">
            </button>
            <button class="pswp__button pswp__button--arrow--right" title="Next (arrow right)">
            </button>
            <div class="pswp__caption">
                <div class="pswp__caption__center"></div>
            </div>
        </div>
    </div>
</div>



    <!-- Global site tag (gtag.js) - Google Analytics -->
    <script async src="//www.googletagmanager.com/gtag/js?id=UA-149874671-1"></script>
    <script>
        window.dataLayer = window.dataLayer || [];
        function gtag(){dataLayer.push(arguments);}
        gtag('js', new Date());

        gtag('config', 'UA-149874671-1');
    </script>





<script>
    function initialTyped () {
        var typedTextEl = $('.typed-text');
        if (typedTextEl && typedTextEl.length > 0) {
            var typed = new Typed('.typed-text', {
                strings: ["Think like an artist, develop like an artisan", "艺术家思维去思考问题，工匠创造精神去开发"],
                typeSpeed: 90,
                loop: true,
                loopCount: Infinity,
                backSpeed: 20,
            });
        }
    }

    if ($('.article-header') && $('.article-header').length) {
        $(document).ready(function () {
            initialTyped();
        });
    }
</script>




</html>
